Skip to content

Conversation

Joshua-Lester3
Copy link
Collaborator

Description

Added progress percent to top of page. I want to iterate on this feature with some of the following possible changes:

  • Perhaps add page number field to Tooling side for the following reasons:
    • More intuitive to enter page number to navigate to it
    • Easier to read/remember than a percentage
    • More accurate
  • Add ability to navigate to percent/page number
  • Add same functionality to tooltip as the following issue suggests

Fixes IntelliTect-dev/EssentialCSharp.Tooling#442

Ensure that your pull request has followed all the steps below:

  • Code compilation
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

Joshua-Lester3 and others added 9 commits July 10, 2025 09:06
Updates code to use `PrimaryKey` instead of `Key`
property in `SiteMapping` for identifying pages.

This change improves clarity and consistency by
using a more descriptive name for the primary key field.
Copilot

This comment was marked as outdated.

Modifies the FindPercentComplete method to return null
when the key is null.

Updates the unit test to reflect the change in behavior.

Updates styling for elements related to current page display.
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a visual progress indicator to content pages by calculating and displaying the percentage of pages viewed, with supporting style and test updates.

  • Introduces a new FindPercentComplete extension and exposes percentComplete in the layout and JS app.
  • Adds CSS rules for .page-menu and .menu-progress to style the progress indicator.
  • Updates tests to cover basic FindPercentComplete scenarios.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wwwroot/js/site.js Added percentComplete ref, isContentPage computed, and exposed progress state
wwwroot/css/styles.css Added .page-menu and .menu-progress styles for the progress display
Views/Shared/_Layout.cshtml Passes percentComplete from server, updates layout to show percentage
Services/SiteMappingListExtensions.cs Implements FindPercentComplete extension with XML docs
Controllers/HomeController.cs Sets ViewBag.CurrentPageKey used by FindPercentComplete
Services/SiteMappingService.cs Cleaned up stray whitespace
Services/ISiteMappingService.cs Normalized namespace declaration
Tests/SiteMappingTests.cs Added tests for null, whitespace, valid, and empty-list scenarios
Comments suppressed due to low confidence (2)

EssentialCSharp.Web.Tests/SiteMappingTests.cs:138

  • There’s no test for the scenario where the key isn’t present in the mappings list. Add a test to verify the behavior (e.g., returns null or "0.00").
        Assert.Equal("0.00", percent);

EssentialCSharp.Web/Extensions/SiteMappingListExtensions.cs:33

  • The XML comment indicates a formatted double but the method returns a string; update the <returns> to reflect that a formatted string is returned.
    /// <returns>Returns a formatted double for use as the percent complete.</returns>

Ensures that the FindPercentComplete method returns "0.00"
when a key is not found in the sitemap, preventing potential
incorrect calculations or errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants